// @flow
import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import LoadingBar from 'components/Base/LoadingBar';
import FullSceenProgress from 'components/Base/FullSceenProgress';
import { BaseActions } from 'store/actionCreators';
import { type State } from 'store';
type Props = {
    windowName: string,
    landing: boolean,
    loadingType: 'bar' | 'full',
    isDone?: boolean
};
class CoresContainer extends Component<Props> {
    componentWillMount() {
        // console.log(BaseActions.setWindoNameRequest());
        BaseActions.setWindowNameRequest({ windowName: '', provider: '' });
    }
    render() {
        return (
            <Fragment>
                {this.props.landingType === 'bar' ? (
                    <LoadingBar
                        start={0}
                        end={100}
                        interval={50}
                        done={this.props.isDone}
                        visible={this.props.landing}
                    />
                ) : (
                    <FullSceenProgress visible={this.props.landing} />
                )}
            </Fragment>
        );
    }
}
// connect([mapStateToProps], [mapDispatchToProps], [mergeProps],[options])
const mapStateToProps = ({ base }: State) => {
    return {
        windowName: base.windowName,
        landing: base.landing,
        landingType: base.landingType,
        isDone: base.isDone
    };
};
const mapDispatchToProps = () => ({});
export default connect(
    mapStateToProps,
    mapDispatchToProps
)(CoresContainer);
